<template>
    <div>
        <pagination
            v-model="pageIndex"
            :page-count="total.Feedback"
            @change="FeedbackTo"
        ></pagination>

        <xin-swipe-cell
            :label="data.desc"
            :title="data.title"
            v-for="(data, index) in Feedback"
            :key="data._id"
            :button="swipeButton"
            @click="handleClick($event, data)"
        >
            <div v-if="data.isDone">已经处理</div>
        </xin-swipe-cell>
    </div>
</template>

<script>
import { mapGetters, mapState } from "vuex";
export default {
    components: {},
    computed: {
        ...mapState({
            Feedback: (state) => state.user.Feedback,
        }),
        ...mapGetters(["total"]),
    },
    mounted() {
        this.FeedbackTo(1);
    },
    data() {
        return {
            swipeButton: [
                {
                    type: "primary",
                    name: "查看",
                },
            ],
            pageIndex: 1,
        };
    },
    methods: {
        handleClick({ name }, data) {
            if (name === "查看") {
                // TODO 添加查看内容的方法
                console.log("查看内容");
                this.$emit("look", data);
            }
        },
        FeedbackTo(index) {
            this.Feedback.$to(index - 1);
        },
    },
};
</script>

<style lang="less" scoped>
.btn {
    height: 100%;
}
</style>